package com.boarsoft.boar.agent.client.pojo;

import java.util.Map;
import java.util.Map.Entry;

/**
 * 对服务采取的动作
 * 
 */
public class Operation {

	/**
	 * RPC代理服务应用地址（{IP}:{PORT}）
	 */
	private String agentAddress;

	/**
	 * 代理执行器绝对路径
	 */
	private String proxyAbsPath;

	/**
	 * 代理执行器相对路径
	 */
	private String proxyRelPath;

	/**
	 * 代理执行器（例如shell脚本名称）
	 */
	private String proxyName;

	/**
	 * 应用服务器地址
	 */
	private String svrAddress;

	/**
	 * 应用服务器登录用户
	 */
	private String svrUser;

	/**
	 * 目标执行器绝对路径
	 */
	private String targetAbsPath;

	/**
	 * 目标执行器（例如shell脚本名称）
	 */
	private String targetName;

	/**
	 * 目标执行器执行参数
	 */
	private Map<String, String> runParams;

	/**
	 * 请求来源方、执行者
	 */
	private String operator;

	public String getAgentAddress() {
		return agentAddress;
	}

	public void setAgentAddress(String agentAddress) {
		this.agentAddress = agentAddress;
	}

	public String getProxyAbsPath() {
		return proxyAbsPath;
	}

	public void setProxyAbsPath(String proxyAbsPath) {
		this.proxyAbsPath = proxyAbsPath;
	}

	public String getProxyRelPath() {
		return proxyRelPath;
	}

	public void setProxyRelPath(String proxyRelPath) {
		this.proxyRelPath = proxyRelPath;
	}

	public String getProxyName() {
		return proxyName;
	}

	public void setProxyName(String proxyName) {
		this.proxyName = proxyName;
	}

	public String getSvrAddress() {
		return svrAddress;
	}

	public void setSvrAddress(String svrAddress) {
		this.svrAddress = svrAddress;
	}

	public String getSvrUser() {
		return svrUser;
	}

	public void setSvrUser(String svrUser) {
		this.svrUser = svrUser;
	}

	public String getTargetAbsPath() {
		return targetAbsPath;
	}

	public void setTargetAbsPath(String targetAbsPath) {
		this.targetAbsPath = targetAbsPath;
	}

	public String getTargetName() {
		return targetName;
	}

	public void setTargetName(String targetName) {
		this.targetName = targetName;
	}

	public Map<String, String> getRunParams() {
		return runParams;
	}

	public String getRunParamsStr() {
		String paramStr = "";
		if (runParams != null && runParams.size() > 0) {
			StringBuffer params = new StringBuffer("\"");
			for (Entry<String, String> en : runParams.entrySet()) {
				params.append(en.getValue()).append("&");
			}
			params.deleteCharAt(params.length() - 1);
			params.append("\"");
			paramStr = params.toString();
		}
		return paramStr;
	}

	public void setRunParams(Map<String, String> runParams) {
		this.runParams = runParams;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

}
